const {createApp} = Vue;
const {ref} = Vue;
const {reactive} = Vue;
const {onMounted} = Vue;

const app = createApp({
	setup() {
		const LoginIcon = ref("../康复训练/img/联系人.png");
		const LanDingData = ref({
			UserName: "",
			PassWord: ""
		});
		const SignUpData=ref({
			UserName: "",
			PassWord: ""
		});
		const FormRule=ref({
			UserName:[
				{pattern: "^[A-Za-z0-9]+$",message: '只能输入英文和数字',trigger: 'change'},
			],
			PassWord:[
				{pattern: "^[A-Za-z0-9]+$",message: '只能输入英文和数字',trigger: 'change'},
			]
				
		});

		function LanDing() {
			//过滤非法字符
			const UserName = LanDingData.value.UserName.replace(/^[A-Za-z0-9]+$/g, "");
			const PassWord = LanDingData.value.PassWord.replace(/^[A-Za-z0-9]+$/g, "");
			if(UserName===""&&PassWord==="")
			{
				
			}
			console.log(LanDingData.value);
		};
		function SignUp(){
			//过滤非法字符
			const UserName = SignUpData.value.UserName.replace(/^[A-Za-z0-9]+$/g, "");
			const PassWord = SignUpData.value.PassWord.replace(/^[A-Za-z0-9]+$/g, "");
			if(UserName===""&&PassWord==="")
			{
				
			}
			console.log(SignUpData.value);
		};
		onMounted(() => {
			console.log(FormRule)
		})
		return {
			LoginIcon,
			LanDing,
			LanDingData,
			FormRule,
			SignUpData,
			SignUp,
			
		}
	}
});
//注册elementui icon全局组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
	app.component(key, component)
};
//注册elementplus
app.use(ElementPlus, {
	locale: ElementPlusLocaleZhCn
});
app.mount('#app');